package javaCode.chapter07.poly_;

public class PolyExercise02 {
    public static void main(String[] args) {
        Sub s = new Sub();
        System.out.println(s.count); //属性看编译类型
        Base b = s; //b 和 s 一起指向了同一个地址
        System.out.println(b == s);
        System.out.println(b.count);
        b.display();
    }
}

class Base{
    int count = 10;

    public void display(){
        System.out.println(this.count);
    }
}

class Sub extends Base{
    int count = 20;

    public void display(){
        System.out.println(this.count);
    }
}
